package com.njxzc.phonegap.utils;

import java.io.UnsupportedEncodingException;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.binary.Base64;
public class phoneGapUtils {
	public static String md5(String source){
		
		byte[] output = null;
		try {
			MessageDigest md = 
					MessageDigest.getInstance("MD5");
			output = md.digest(source.getBytes("utf-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		String s = Base64.encodeBase64String(output);
		
		return s ;
	}
}
